%h1.page_title Photo Edit
%table.edit_photo
  - form_for @photo, :method => :update do |form|
    %tr
      %td.photo{:colspan => 2}
        %img.large_screen_photo{:src => @photo.public_filename(:screen), :title => (@photo.caption ? @photo.caption : @photo.filename), :alt => (@photo.caption ? @photo.caption : @photo.filename)}
    %tr
      %td.field_title Galleries:
      %td.field
        - if @galleries.empty?
          No galleries have been created yet.
          %a{:href => new_gallery_url, :title => "Create a new Gallery"}Create one
        - else
          %select{:id => "photo[gallery_ids][]", :name => "photo[gallery_ids][]", :multiple => true, :size => 8, :width => 10}
            - @galleries.each do |gallery|
              %option{:value => gallery.id, :selected => ("selected" if @photo.galleries.include?(gallery))}= gallery.name
      %td.error= error_message_on :photo, :gallery_ids
    %tr
      %td.field_title Options:
      %td.field
        %table.photo_options
          %tr
            %td.photo_options_field= check_box_tag("photo[random]", 1, @photo.random?)
            %td.photo_options_field_title One of the images that cycles on the homepage
            %td.error= error_message_on :photo, :random
          %tr
            %td.photo_options_field= check_box_tag("photo[is_thumbnail]", 1, @photo.is_thumbnail?)
            %td.photo_options_field_title Part of the thumbnails image group
            %td.error= error_message_on :photo, :is_thumbnail
          %tr
            %td.photo_options_field= check_box_tag("photo[non_purchasable]", 1, @photo.non_purchasable?)
            %td.photo_options_field_title Make unavailable for purchase
            %td.error= error_message_on :photo, :non_purchasable
          %tr
            %td.photo_options_field=check_box_tag("photo[is_private]", 1, @photo.is_private?)
            %td.photo_options_field_title Mark this photo as private
            %td.error= error_message_on :photo, :is_private
    %tr
      %td.field_title Caption: 
      %td.field= form.text_area     :caption
      %td.error= error_message_on   :photo, :caption
    %tr
      %td.field_title Location:
      %td.field= form.text_field    :location
      %td.error= error_message_on   :photo, :caption
    %tr
      %td.field_title City:
      %td.field= form.text_field    :city
      %td.error= error_message_on   :photo, :city
    %tr
      %td.field_title State:
      %td.field= form.text_field    :state
      %td.error= error_message_on   :photo, :state
    %tr
      %td.field_title Country:
      %td.field= form.text_field    :country
      %td.error= error_message_on   :photo, :country
    %tr
      %td.field_title Keywords:
      %td.field= form.text_field    :keywords
      %td.error= error_message_on   :photo, :keywords
    %tr
      %td.field_title Metadata:
      %td.field
        %table.photo_metadata
          %tr
            %td
              %table
                %tr
                  %td.metadata_field_title Author:
                  %td.metadata_field= @photo.author
                %tr
                  %td.metadata_field_title Camera Make:
                  %td.metadata_field=@photo.camera_make
                %tr
                  %td.metadata_field_title Camera Model:
                  %td.metadata_field=@photo.camera_model
                %tr
                  %td.metadata_field_title Camera Serial Number:
                  %td.metadata_field=@photo.camera_serial_number
                %tr
                  %td.metadata_field_title Exposure Time:
                  %td.metadata_field=@photo.exposure_time
                %tr
                  %td.metadata_field_title F Stop:
                  %td.metadata_field=@photo.fstop
            %td
              %table
                %tr
                  %td.metadata_field_title Shutter Speed:
                  %td.metadata_field=@photo.shutter_speed
                %tr
                  %td.metadata_field_title Focal Length:
                  %td.metadata_field=@photo.focal_length
                %tr
                  %td.metadata_field_title ISO Rating:
                  %td.metadata_field=@photo.iso_rating
                %tr
                  %td.metadata_field_title Lens: 
                  %td.metadata_field=@photo.lens
                %tr
                  %td.metadata_field_title Time Stamp:
                  %td.metadata_field= @photo.date_time
    %tr
      %td
      %td.submit= submit_tag 'update'
  - form_for @photo, photos_url, :html => {:method => :delete} do |form|
    %tr
      %td
      %td{:colspan => "2"}= submit_tag 'Delete'
%h2 Comments:
- if @photo.comments.empty?
  %p No one has said anything about this photo yet.
-else 
  %div.photo_comments
    - @photo.comments.each do |comment|
      %div.comment_container
        %div.creation_information
          %div.user_login
            %a{:href => user_url(comment.user)}= comment.user.login
          %div.comment_time
            = comment.created_at.strftime("%m/%d/%y at %I:%M %p")
          - if logged_in? && current_user.is_admin?
            %div.delete_comment
              - form_for comment, :html => {:method => :delete} do |form|
                = submit_tag "delete"
        %div.user_comment
          = comment.text
      %div.clear_fix